package study.算法;

import java.util.Arrays;
import java.util.List;

/**
 * @Author 刘伟涛
 * @Date 2024/3/8 16:05
 **/
public class 冒泡排序 {
    public static void main(String[] args) {
        List<Integer> integers = Arrays.asList(12, 4, 5, 6, 7, 3, 7, 1, 7, 3, 8, 32, 84, 13, 3);
        int max;
        for (int i = 0; i < integers.size(); i++){
            for (int g = 0; g < integers.size()-i; g++) {
                max = integers.get(g);
                if (g<integers.size()-i-1 && max >= integers.get(g+1)  ){
                    integers.set(g,integers.get(g+1));
                    integers.set(g+1,max);
                }
            }
        }

        System.out.println(integers);
    }
}
